package org.jadestudio.dsdown.service;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.jadestudio.dsdown.dao.ArticleManageDao;
import org.jadestudio.dsdown.dao.GameManageDao;
import org.jadestudio.dsdown.dao.ManageLoginDao;
import org.jadestudio.dsdown.entity.ManageAdminLogin;
import org.jadestudio.dsdown.entity.ManageArticle;
import org.jadestudio.dsdown.entity.ManageGame;
import org.jadestudio.dsdown.entity.ManageGameDownloads;
import org.jadestudio.dsdown.entity.ManageGamePic;
import org.jadestudio.dsdown.entity.ManageGamePublishCompany;
import org.jadestudio.dsdown.entity.ManageGamePurchase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.sun.xml.internal.ws.api.PropertySet.Property;

@Component
public class ArticleManageService {
	@Resource
	private ArticleManageDao articleManageDao;

	
	public List<java.util.Map> getArticleTypeList() throws Exception{
		try{
			return this.articleManageDao.getArticleTypeList();
		}catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * 游戏模糊查询（返回json）
	 */
	public List<java.util.Map> gameQueryByName(String requestString) throws Exception{
		try{
			return this.articleManageDao.gameQueryByName(requestString);
		}catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * 文章新增逻辑
	 * @param manageArticle
	 * @return
	 * @throws Exception
	 */
	public String articleAdd(ManageArticle manageArticle) throws Exception{
		try{
			return this.articleManageDao.articleAdd(manageArticle);
		}catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * 文章修改逻辑
	 * @param manageArticle
	 * @return
	 * @throws Exception
	 */
	public String articleModify(ManageArticle manageArticle) throws Exception{
		try{
			return this.articleManageDao.articleModify(manageArticle);
		}catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * 文章模糊查询(带分页)
	 */
	public List<java.util.Map> articleQueryByPaging(Map queryMap) throws Exception{
		try{
			return this.articleManageDao.articleQueryByPaging(queryMap);
		}catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * 文章数量查询(带分页)
	 */
	public int articleCountQuery(Map queryMap) throws Exception{
		try{
			return this.articleManageDao.articleCountQuery(queryMap);
		}catch(Exception e){
			e.printStackTrace();
		}
		return 0;
	}
	
	/**
	 * 文章删除BYID
	 */
	public int articleDeleteById(String articleId) throws Exception{
		try{
			return this.articleManageDao.articleDeleteById(articleId);
		}catch(Exception e){
			e.printStackTrace();
		}
		return 0;
	}
	
	/**
	 * 文章查询BYID
	 */
	public Map articleQueryById(String articleId) throws Exception{
		try{
			return this.articleManageDao.articleQueryById(articleId);
		}catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}
	
	
	/**
	 * 游戏文章关联表t11_game_article查询BYID
	 * @param articleId
	 * @return
	 * @throws Exception
	 */
	public List<Map> gameArticleQueryByArticleId(String articleId)throws Exception{
		return this.articleManageDao.gameArticleQueryByArticleId(articleId);
	}
	
	
	
	
}
